#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>

using namespace std;

int jewelleryValue(vector<vector<int>>& frame) {
    int m = frame.size();
    int n = frame[0].size();

    vector<vector<int>> dp(220, vector<int>(220, 0));


    for (int i = 1; i <= m;++i)
    {
        for (int j = 1; j <= n;++j)
        {
            if (i == 1)
            {
                dp[i][j] = frame[i - 1][j - 1] + dp[i][j - 1];
            }
            else if (j == 1)
            {
                dp[i][j] = frame[i - 1][j - 1] + dp[i - 1][j];
            }
            else
            {
                dp[i][j] = frame[i - 1][j - 1] + max(dp[i - 1][j], dp[i][j - 1]);
            }
        }
    }

    return dp[m][n];
}
int main()
{
    jewelleryValue({ {1, 3, 1}, {1, 5, 1} , {4, 2, 1} });

	return 0;
}